<template>
  <Panel title="访客通道摄像头监控" width="380px">
    <div class="scroll-view">
      <div class="grid">
        <div class="grid-item" v-for="item in contacts">
          <div class="monitor">
            <div class="video">
              <img class="video-pre" src="/images/monitor.png" />
              <div class="title">
                {{ item.name }}
                <div class="subtitle">{{ item.date }}</div>
              </div>
            </div>
            <div class="area">{{ item.area }}</div>
          </div>
        </div>
      </div>
    </div>
  </Panel>
</template>

<script lang="ts" setup>
function rowClass(target) {
  switch (target.row.status) {
    case "正常":
      return "row-success";
    case "报警":
      return "row-danger";
    case "故障":
      return "row-warning";
    default:
      return "row-info";
  }
}
const contacts = ref([
  { id: "1", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "在线", date: "2021-9-28 10:22:35" },
  { id: "2", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "在线", date: "2021-9-28 10:22:35" },
  { id: "3", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "通话中", date: "2021-9-28 10:22:35" },
  { id: "4", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "在线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "在线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "离线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "离线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "离线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "离线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "离线", date: "2021-9-28 10:22:35" },
  { id: "5", img: "img", name: "区域一", code: "A00101", area: "1楼A区机房", status: "离线", date: "2021-9-28 10:22:35" },
]);

onMounted(() => {});
</script>
<style lang="scss" scoped>
.scroll-view {
  margin: 16px 0px;
  height: 480px;
  overflow-y: auto;
  &::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 5px;
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    background-color: #2f80ed;
  }

  &::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    background-color: rgba(37, 96, 255, 0.31);
  }
}
.grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;

  .grid-item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 6px;
    align-items: center;
    width: 47%;
    color: #fff;
    .monitor {
      display: flex;
      flex-direction: column;
      .video {
        height: 120px;
        width: 100%;
        position: relative;
        img {
          height: 100%;
          width: 100%;
        }
      }
      .title {
        width: 100%;
        padding: 4px;
        font-size: 16px;
        position: absolute;
        bottom: 0;
        text-align: left;
        padding-left: 6px;
        font-size: 10px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.6) 100%);
        display: flex;
        justify-content: space-between;
        align-items: center;
        .subtitle {
        }
      }
      .area {
        text-align: left;
        background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) -2%, rgba(255, 255, 255, 0) 100%);
        padding-left: 6px;
        font-size: 14px;
      }
    }
  }
}
</style>
